package com.example.service;

import com.example.entity.MedicalInstitution;
import com.example.mapper.MedicalInstitutionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MedicalInstitutionService {
    
    @Autowired
    private MedicalInstitutionMapper medicalInstitutionMapper;

    public void addMedicalInstitution(MedicalInstitution institution) {
        medicalInstitutionMapper.insert(institution);  // 创建医保机构
    }

    public MedicalInstitution getMedicalInstitutionById(int id) {
        return medicalInstitutionMapper.selectById(id);  // 查询医保机构
    }

    public List<MedicalInstitution> getAllMedicalInstitutions() {
        return medicalInstitutionMapper.selectList(null);  // 查询所有医保机构
    }

    public void updateMedicalInstitution(MedicalInstitution institution) {
        medicalInstitutionMapper.updateById(institution);  // 更新医保机构信息
    }

    public void deleteMedicalInstitution(int id) {
        medicalInstitutionMapper.deleteById(id);  // 删除医保机构
    }
}
